package com.tuananh.radnom.gwt.shared.event;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.GwtEvent.Type;
import com.tuananh.radnom.gwt.shared.dto.MyBaseDTO;

public class ServiceTreeEvent extends GwtEvent<ServiceTreeEventHandler> {
	MyBaseDTO selectedItem;

	public ServiceTreeEvent() {

	}

	public ServiceTreeEvent(MyBaseDTO selectedItem) {
		this.selectedItem = selectedItem;
	}

	public static final Type<ServiceTreeEventHandler> TYPE = new Type<ServiceTreeEventHandler>();

	@Override
	public com.google.gwt.event.shared.GwtEvent.Type<ServiceTreeEventHandler> getAssociatedType() {
		// TODO Auto-generated method stub
		return TYPE;
	}

	@Override
	protected void dispatch(ServiceTreeEventHandler handler) {
		// TODO Auto-generated method stub
		if (selectedItem != null)
			handler.onServiceSelect(selectedItem);
	}

}
